package org.pocketmoney.core;

import java.io.IOException;
import java.util.*;

import org.pocketmoney.core.entities.IHuman;
import org.pocketmoney.core.entities.record.ICreditRecord;
import org.pocketmoney.core.entities.record.IPurchaseRecord;
import org.pocketmoney.core.entities.record.ISalaryRecord;
import org.pocketmoney.core.entities.record.ITributeRecord;
import org.pocketmoney.core.entities.record.Record;

public class RecordBank 
{

	private static final RecordBank inst = new RecordBank();
	protected List<Record> allRecords = null;
	protected List<IHuman> allHumans = null;
	protected Map<Long, ICreditRecord> creditRecords = null;
	protected Map<Long, ISalaryRecord> salaryRecords = null;
	protected Map<Long, ITributeRecord> tributeRecords = null;
	protected Map<Long, IPurchaseRecord> purchaseRecords = null;
	
	private RecordBank()
	{
		allRecords = new LinkedList<Record>();
		creditRecords = new HashMap<Long, ICreditRecord>();
		salaryRecords = new HashMap<Long, ISalaryRecord>();
		tributeRecords = new HashMap<Long, ITributeRecord>();
		purchaseRecords = new HashMap<Long, IPurchaseRecord>();
	}
	
	public static RecordBank getInst()
	{
		return inst;
	}
	
	public void save() throws IOException
	{
		
	}
	
	public void load()
	{
		
	}
	
	public void addRecord(Record record)
	{
		allRecords.add(record);
	}
	
	public List<Record> getAllRecords()
	{
		return allRecords;
	}
	
	public Record getRecordById(long id)
	{
		return null;
	}
	
	public Record getRecordByIndex(int index)
	{
		return allRecords.get(index);
	}
	
	public List<IHuman> getAllHumans()
	{
		return allHumans;
	}
	
	public int getRecordsCount()
	{
		return allRecords.size();
	}
	
	public void archiveOldRecords()
	{
		//Element rootElement = new Element();
		//Document doc = new Document(rootElement);
	}


	

	
}
